package com.hpin.mlxteacher.utils;

/**
 * Created by Administrator on 2015/7/14.
 * 常量类
 */
public class Constant {

    public final static String WEB_ROOT = "http://192.168.1.127:8080/minglu/api/teacher/";

    //登陆url
    public final static String LOGIN = "login";
    //忘记密码url
    public final static String FORGET = "forget";

    public final static String CONFIG = "mingluxing_config";


    public static final String NEWS = "NEWS";
    public static final String CHILD = "CHILD";
    public static final String PHOTO = "PHOTO";
    public static final String BABYTREE = "BABYTREE";
    public static final String MY = "MY";
    //添加的图片 + 的地址 (乱写的地址)
    public static String ADDBITMAPPATH = "mlx/add.jpg";


    public static String NODATA = "数据获取失败";
    public static String NOMOREDATA = "没有更多数据了";
    public static String LOADING = "加载中...";
    public static String WAIT = "请稍后...";
    public static String MODIFY = "修改中...";


    private static final int FA_UNKNOW_ERROR = 00;
    private static final int FA_PHONENUM_EXIST = 010;
    private static final int FA_MSCODE_ERROR = 0120;
    private static final int FA_MSCODESEND_ERROR = 030;
    private static final int FA_AES_ERROR = 005;
    private static final int FA_PHONENUM_ERROR = 01230;
    private static final int FA_PASSWORD_ERROR = 4200;
    private static final int FA_PHNOEKEY_ERROR = 0007;
    private static final int FA_DEVICEID_ERROR = 000020;
    private static final int FA_TOKEN_ERROR = 1012;
    private static final int FA_DATA_ERROR = 1023;
    private static final int FA_PHONENUM_NOT_EXIST = 12200;
    private static final int FA_DEVICECONNECT_ERROR = 3200;
    private static final int FA_BIND_ERROR = 32100;
    private static final int FA_BIND_ERROR_INVITATION = 24500;
    private static final int FA_BINDING_ALREADY = 6700;
    private static final int MESSAGE = 8900;
    private static final int BIND_MESSAGE = 89010;
    private static final int FA_DATA_FORMATE_ERROR = 89002;
    private static final int SAFEAREA_MESSAGE = 89003;
    private static final int BATTERY_MESSAGE = 89040;


    public static String showErrorMsg(int code) {


        String errorMessage = "";

        switch (code) {

//            case FA_UNKNOW_ERROR:
//                errorMessage = "未知错误";
//                break;
            case FA_PHONENUM_EXIST:
                errorMessage = "电话号码已存在";
                break;
            case FA_MSCODE_ERROR:
                errorMessage = "短信验证码错误";
                break;
            case FA_MSCODESEND_ERROR:
                errorMessage = "短信验证码发送失败";
                break;
            case FA_AES_ERROR:
                errorMessage = "解密失败";
                break;
            case FA_PHONENUM_ERROR:
                errorMessage = "电话号码错误";
                break;
            case FA_PASSWORD_ERROR:
                errorMessage = "密码错误";
                break;
            case FA_PHNOEKEY_ERROR:
                errorMessage = "phonekey与上次登陆时不一致";
//        // errorMessage = "";
//        Context applicationContext = MyApplication.getInstance()
//                .getApplicationContext();
//        Intent intent = new Intent(Constant.FA_PHNOEKEY_ERROR_ACTION);
//        applicationContext.sendBroadcast(intent);
//        break;
////			Intent intent = new Intent(applicationContext, LoginActivity.class);
////			applicationContext.startActivity(intent);
//
////			return;
                break;
            case FA_DEVICEID_ERROR:
                errorMessage = "设备ID错误";
                break;
            case FA_TOKEN_ERROR:
                errorMessage = "设备token错误";
                break;
            case FA_DATA_ERROR:
                errorMessage = "数据库中无记录";
                break;
            case FA_PHONENUM_NOT_EXIST:
                errorMessage = "电话号码不存在";
                break;
            case FA_DEVICECONNECT_ERROR:
                errorMessage = "设备无连接";
                break;
            case FA_BIND_ERROR:
                errorMessage = "SN码错误";
                break;
            case FA_BIND_ERROR_INVITATION:
                errorMessage = "邀请码错误";
                break;
            case FA_BINDING_ALREADY:
                errorMessage = "已经绑定";
                break;
            case MESSAGE:
                errorMessage = "普通消息";
                break;
            case BIND_MESSAGE:
                errorMessage = "绑定消息";
                break;
            case FA_DATA_FORMATE_ERROR:
                errorMessage = "数据格式错误";
                break;
            case SAFEAREA_MESSAGE:
                errorMessage = "安全围栏消息";
                break;
            case BATTERY_MESSAGE:
                errorMessage = "电量消息";
                break;
            default:
                errorMessage = "未知错误";

                LogUtil.e("err", "没有对应的code!!!!!");

                break;

        }
        return errorMessage;

    }

}
